﻿using System;
using System.Collections.Generic;
using System.Text;
using StarBotDotNet;

namespace StarBotDotNet.BuildStateCheckers
{
    public class StateCheckerAquiredProduced:StateCheckerAbstract
    {
        protected override bool CanEnterThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            return true;
        }

        protected override bool CanTryToMoveToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            if (target.UnitProduced != null)
            {
                if (target.Builder == null)
                {
                    if (target.UnitProduced.Unit.IsCompleted)
                    {
                        return true;

                    }
                }

            }
            return false;
        }

        protected override void AfterMovingToState(ProxyBot bot, IBuildingParty buildingParty, BuildTarget target)
        {
            //buildingParty.DiscoveredUnhandled.Remove(target.UnitProduced);
            base.AfterMovingToState( bot,buildingParty, target);
        }


        protected override void InitiateMovingToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            //
        }

        protected override void PrepareInitiationOfMovingToThisState(IBuildingParty buildingParty, BuildTarget target, StarBotDotNet.ProxyBot bot, UnitDictionary currentUnits, int currentTime)
        {
            
        }

        public override BuildStateEnum StateFrom
        {
            get { return BuildStateEnum.b0_Initial; }
        }

        public override BuildStateEnum StateTo
        {
            get { return BuildStateEnum.b8_Finished;  }
        }
    }
}
